package com.tesis_2.UI;

import java.util.ArrayList;

import org.json.JSONException;

import com.example.tesis_2.R;
import com.example.tesis_2.R.layout;
import com.example.tesis_2.R.menu;
import com.tesis_2.BL.BLComentarios;
import com.tesis_2.MO.MOComentario;
import com.tesis_2.Utils.UTComentariosArrayAdapter;

import android.os.Bundle;
import android.app.Activity;
import android.app.ListActivity;
import android.view.Menu;

public class UIComentarios extends ListActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		//ya que es list activity
		//setContentView(R.layout.activity_comentarios);
		
		Bundle b = getIntent().getExtras();
		int nRestId = b.getInt("RestId");
		ArrayList<MOComentario> lsComentarios = new ArrayList<MOComentario>();
		try {
			lsComentarios = BLComentarios.getComentarioByRestId(nRestId);
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		setListAdapter( new UTComentariosArrayAdapter(this, lsComentarios));
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_comentarios, menu);
		return true;
	}
	
	

}
